package com.xybian.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Hello 控制器
 *
 * @author SongRenShuo
 * @date 2023-12-23
 */
@RestController
public class HelloController {

    @GetMapping("/hello")
    @PreAuthorize("@authenticationExpression.hasTrue('admin')")
    public String hello() {

        return "hello security  admin!";
    }

    @GetMapping("/permission")
    @PreAuthorize("hasAnyAuthority('admin','user')")
    public String security() {

        return "hello security permission  admin-user!";
    }
}
